package com.league.zjxn.base

import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.LogUtils
import com.module.lemlin.http.HttpServiceRxHttpManager
import com.module.lemlin.http.ProgressListener
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.disposables.Disposable
import rxhttp.RxHttp

open class BaseManager : HttpServiceRxHttpManager() {
    fun download(
        url: String, localPath: String, listener: ProgressListener? = null
    ): Disposable = RxHttp.get(url)
        .setSync()
        .asAppendDownload(localPath, AndroidSchedulers.mainThread()) {
            listener?.onProgress(it)
            LogUtils.e(GsonUtils.toJson(it))
        }
        .subscribe {
            LogUtils.e("====${it}")
        }
}